from fastapi import FastAPI

from .middleware import register_cross, register_middleware
from apps.api.api import init_sub_app as init_api_app


def init_app(app: FastAPI) -> FastAPI:
    """the entrance to init app"""

    register_cross(app)
    register_middleware(app)

    app = init_api_app(app)

    return app
